//
//  homefootview.swift
//  mywei
//
//  Created by myd on 15/12/19.
//  Copyright © 2015年 myd1. All rights reserved.
//

import UIKit

class homefootview: UIView {

    override init(frame: CGRect) {
        let ff = CGRectMake(0, 0, UIScreen.mainScreen().bounds.size.width, 35)
        super.init(frame: ff)
        backgroundColor = UIColor . orangeColor()
        setview()
    }
     let lab : UILabel = UILabel()
    let act = UIActivityIndicatorView()
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
  
    func setview()
    {
       
        lab.text = "正在拼命加载中"
        lab.tintColor = UIColor . blackColor()
        self.addSubview(lab)
        
        act.hidesWhenStopped = true
        act.startAnimating()
        act.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray
        addSubview(act)
       setframe()
    }
    func setframe()
    {
      lab.translatesAutoresizingMaskIntoConstraints = false
     act .translatesAutoresizingMaskIntoConstraints = false
     addConstraint(NSLayoutConstraint(item: lab, attribute: NSLayoutAttribute.CenterX, relatedBy: NSLayoutRelation.Equal, toItem: self, attribute: NSLayoutAttribute.CenterX, multiplier: 1, constant: 0))
        addConstraint(NSLayoutConstraint(item: lab , attribute: NSLayoutAttribute.CenterY, relatedBy: NSLayoutRelation.Equal, toItem: self, attribute: NSLayoutAttribute.CenterY, multiplier: 1, constant: 0))
//        lab.sizeToFit()
        
        addConstraint(NSLayoutConstraint(item: act, attribute: NSLayoutAttribute.CenterY, relatedBy: NSLayoutRelation.Equal, toItem: lab, attribute: NSLayoutAttribute.CenterY, multiplier: 1, constant: 0))
        addConstraint(NSLayoutConstraint(item: act, attribute: NSLayoutAttribute.Left, relatedBy: NSLayoutRelation.Equal, toItem: lab, attribute: NSLayoutAttribute.Right, multiplier: 1, constant: 10))
    }

}
